#include <iostream>
#include <stack>
using namespace std;

void tohex(int n)
{
	stack<int> S;
	int k;
	do{
		k = n & 0x0F;
		S.push(k);
		n = n >> 4;
	}while(n);
	while(!S.empty())
	{
		k = S.top();
		S.pop();
		if(k < 10)
			cout << k;
		else
			cout << char('A'+ k - 10);
	}
}



int main()
{
	tohex(33);
	cout << endl;
	tohex(47);
	cout << endl;
	tohex(0); 
	cout << endl;
	return 0;
}

